package com.zpark.se.io.serialize;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
 * @PackageName: com.zpark.se.io.serialize
 * @ClassName: Demo02
 * @Description:
 * @author: RZS
 * @date: 2024/11/25  10:10
 */
public class Demo02 {
    public static void main(String[] args) throws Exception {
        // 将对象进行反序列化
        // 创建对象输入流对象
        ObjectInputStream ois = new ObjectInputStream(
                new FileInputStream(
                        new File("src/com/zpark/se/io/serialize/obj/dc.obj")
                )
        );

        // 读取数据
        Object o = ois.readObject();
        // 类型转换
        Person dc = (Person) o;

        System.out.println(dc);


        // 关闭流
        ois.close();
    }
}
